home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / util / backdrop.1 < prev    next >
Text File  |  1989-05-11  |  41KB  |  1,104 lines

  1. Path: xanth!ames!sun-barr!sun!swap!page
  2. From: page%swap@Sun.COM (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i127:  backdrop - put pattern behind cli windows
  5. Message-ID: <104265@sun.Eng.Sun.COM>
  6. Date: 11 May 89 07:44:35 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1093
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: ecarroll@vax1.tcd.ie (Eddy Carroll)
  12. Posting-number: Volume 89, Issue 127
  13. Archive-name: util/backdrop.1
  14.  
  15. Backdrop puts a pattern in the area behind the CLI windows.  The only
  16. program I had which would give a similar effect was DropCloth by Eric
  17. Lavitsky, but this requires Workbench to be loaded.  Backdrop won't
  18. work very well with Workbench, which suits me fine since I hardly ever
  19. use Workbench.
  20.  
  21. [uuencoded exectuable included.  ..bob]
  22.  
  23. # This is a shell archive.
  24. # Remove anything above and including the cut line.
  25. # Then run the rest of the file through 'sh'.
  26. # Unpacked files will be owned by you and have default permissions.
  27. #----cut here-----cut here-----cut here-----cut here----#
  28. #!/bin/sh
  29. # shar: SHell ARchive
  30. # Run the following text through 'sh' to create:
  31. #    README
  32. #    backdrop.c
  33. #    atoi.a
  34. #    res.a
  35. #    tiny.a
  36. #    Makefile
  37. #    Sys-Conf.uu
  38. #    backdrop.uu
  39. #    backdrop.n
  40. # This is archive 1 of a 1-part kit.
  41. # This archive created: Thu May 11 00:35:34 1989
  42. echo "extracting README"
  43. sed 's/^X//' << \SHAR_EOF > README
  44. XThis archive includes all the files necessary to recreate a working copy
  45. Xof Backdrop, a utility which puts a pattern in the area behind the CLI
  46. Xwindow. See Backdrop.n for more information.
  47. X
  48. XAlso included is a System-Configuration file which you can copy into the
  49. XDEVS directory of your system disk. It makes your Amiga boot up with an
  50. Xinterlaced overscan workbench, giving you an resolution of around 704x562
  51. X(on a PAL screen). When used with Backdrop, this can make for a very
  52. Xdisplay which looks like those seen on expensive workstations (and Macs).
  53. XFor best effect, turn the contrast and brightness down to prevent flicker
  54. X(unless you are fortunate enough to have a Flicker Fixer). It's not really
  55. Xthat usable on a normal monitor, but it looks impressive.
  56. SHAR_EOF
  57. echo "extracting backdrop.c"
  58. sed 's/^X//' << \SHAR_EOF > backdrop.c
  59. X/*
  60. X * Backdrop (C) Copyright Eddy Carroll 1989, may be Freely Redistributed
  61. X *
  62. X * Backdrop allows you to define a pattern which will then be displayed
  63. X * in the empty screen area behind all the windows (who said Macintosh? :-)
  64. X *
  65. X * Usage: Backdrop { -a# | -b# | -f | -p# | -q | -s | B1B2B3B4B5B6B7B8}
  66. X *
  67. X * If no parameters are given, the default is a half tone grey pattern.
  68. X *
  69. X * -a or -b followed by a number sets the foreground or background colour
  70. X * to the corresponding pen number (0 - 3)
  71. X *
  72. X * -f and -s select either a SMART_REFRESH or SIMPLE_REFRESH window to
  73. X * display the backdrop pattern in. The former gives fast screen updates,
  74. X * but uses up quite a bit of memory, whereas the latter uses up very
  75. X * little memory but is slower at updating the screen.
  76. X *
  77. X * -p followed by a number selects the built in pattern corresponding to that
  78. X * number. If you try and select a pattern number not available, you get
  79. X * the default.
  80. X *
  81. X * -q kills the background copy of Backdrop currently installed, if any.
  82. X *
  83. X * A list of 16 hex digits will be interpreted as a user defined pattern,
  84. X * which should be viewed as an 8x8 grid.
  85. X *
  86. X * The first time you run Backdrop, it installs itself in memory. Future
  87. X * invocations of Backdrop will merely tell this first copy about any
  88. X * changes in parameters, until the -q option is used to remove it. Note
  89. X * that all the parameters, including window type, can be changed even
  90. X * while Backdrop is currently running.
  91. X *
  92. X * Compiles under Lattice C V4.0
  93. X *
  94. X */
  95. X
  96. X#include <exec/types.h>
  97. X#include <graphics/gfxbase.h>
  98. X#include <graphics/gfxmacros.h>
  99. X#include <intuition/intuition.h>
  100. X#include <intuition/intuitionbase.h>
  101. X#include <libraries/dos.h>
  102. X#include <proto/exec.h>
  103. X#include <proto/graphics.h>
  104. X#include <proto/dos.h>
  105. X#include <proto/intuition.h>
  106. X#include <string.h>
  107. X
  108. X#define tolower(c) ((c) >= 'A' && (c) <= 'Z' ? (c) + 'a' - 'A' : (c))
  109. X#define YES        1
  110. X#define NO        0
  111. X#define NUMPATS    19        /* Number of predefined patterns available        */
  112. X#define REPEAT  9999    /* Special return value indicates reopen window */
  113. X#define UNSET    -1        /* Indicates a parameter is currently unset        */
  114. X
  115. X#define htoi(c) (((c) - '0' - 7 * ((c) >= 'A')) & 0x0F)    /* Hex to int */
  116. X
  117. Xstruct IntuitionBase *IntuitionBase;
  118. Xstruct GfxBase *GfxBase;
  119. XULONG BackGroundIO = 0;
  120. X
  121. Xchar usage1[] = "\
  122. XBackdrop (C) Copyright Eddy Carroll 1989, adds backdrop to Workbench screen\n",
  123. Xusage2[] = "\
  124. XUsage: Backdrop {-f | -p# | -q | -s | B1B2B3B4B5B6B7B8}\n\
  125. X\n\
  126. X        -a# - Set foreground colour to specified pen #\n\
  127. X        -b# - Set background colour to specified pen #\n",
  128. Xusage3[] = "\
  129. X        -f  - Enable fast update (uses more memory)\n\
  130. X        -p# - Use specified pattern # (1-5)\n\
  131. X        -q  - Remove backdrop from memory\n\
  132. X        -s  - Enable slow update\n\
  133. X   B1B2B3B4B5B6B7B8 - 16 hex digits defining an 8x8 pattern\n\
  134. X\n> ";
  135. X
  136. Xchar Portname[] = "Backdrop";
  137. X
  138. Xstruct Pattern {
  139. X    UWORD value[8];
  140. X} Patterns[] = {
  141. X    { 0x5555,0xAAAA,0x5555,0xAAAA,0x5555,0xAAAA,0x5555,0xAAAA }, /* Check */
  142. X    { 0xFFFF,0x4040,0x4040,0x4040,0xFFFF,0x0404,0x0404,0x0404 }, /* Brick */
  143. X    { 0x8888,0x0000,0x0000,0x0000,0x8888,0x0000,0x0000,0x0000 },
  144. X    { 0x8888,0x0000,0x2222,0x0000,0x8888,0x0000,0x2222,0x0000 },
  145. X    { 0xAAAA,0x0000,0xAAAA,0x0000,0xAAAA,0x0000,0xAAAA,0x0000 },
  146. X    { 0xAAAA,0x0000,0x5555,0x0000,0xAAAA,0x0000,0x5555,0x0000 },
  147. X    { 0x8888,0x2222,0x8888,0x2222,0x8888,0x2222,0x8888,0x2222 },
  148. X    { 0xAAAA,0xAAAA,0x5555,0x5555,0xAAAA,0xAAAA,0x5555,0x5555 },
  149. X    { 0xCCCC,0x3333,0xCCCC,0x3333,0xCCCC,0x3333,0xCCCC,0x3333 },
  150. X    { 0xFFFF,0x8181,0xBDBD,0xA5A5,0xA5A5,0xBDBD,0x8181,0xFFFF },
  151. X    { 0xFEFE,0x8282,0xBABA,0xAAAA,0xBABA,0x8282,0xFEFE,0x0000 },
  152. X    { 0x9999,0xCCCC,0x6666,0x3333,0x9999,0xCCCC,0x6666,0x3333 },
  153. X    { 0x9999,0x3333,0x6666,0xCCCC,0x9999,0x3333,0x6666,0xCCCC },
  154. X    { 0x0000,0x4444,0x2828,0x1010,0x2828,0x4444,0x0000,0x0000 },
  155. X    { 0x0000,0x5454,0x0202,0x5858,0x1A1A,0x4040,0x2A2A,0x0000 },
  156. X    { 0xAAAA,0x4444,0xAAAA,0x0000,0xAAAA,0x4444,0xAAAA,0x0000 },
  157. X    { 0xC3C3,0x6666,0x3C3C,0x1818,0x3C3C,0x6666,0xC3C3,0x8181 },
  158. X    { 0xDBDB,0x6666,0x3C3C,0x9999,0x9999,0x3C3C,0x6666,0xDBDB },
  159. X    { 0x6666,0xF0F0,0x9999,0x0F0F,0x6666,0xF0F0,0x9999,0x0F0F },
  160. X    { 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF }
  161. X};
  162. X
  163. Xstruct MyMsgPort {
  164. X    struct MsgPort mp;                /* A genuine message port    */
  165. X    struct Pattern pat;                /* Current pattern            */
  166. X    ULONG  windowflags;                /* Flags for our window        */
  167. X    UBYTE  foreground,background;    /* Colours for window        */
  168. X} port;
  169. X
  170. Xtypedef struct MessagePort    MP;
  171. Xtypedef struct MyMsgPort    MyMP;
  172. Xtypedef struct IntuiMessage    IM;
  173. X
  174. X#define WINDOWFLAGS    (BORDERLESS | BACKDROP)
  175. X
  176. Xstruct NewWindow nw = {
  177. X    0,0,
  178. X    320,200,    /* Max dimensions will be filled in at run time */
  179. X    0,1,        /* These colours are also filled in at run time */
  180. X    REFRESHWINDOW,
  181. X    NULL,    /* Window flags will be filled in at run time */
  182. X    NULL, NULL,
  183. X    NULL,
  184. X    NULL, NULL,
  185. X    0,0,0,0,
  186. X    WBENCHSCREEN
  187. X};
  188. X
  189. X/*
  190. X * The start of the program. All main does is interpret the command line
  191. X * parameters, and then determine whether there is already a copy of Backdrop
  192. X * running or not. If there isn't, a public message port is set up for
  193. X * future reference, else the other copy of Backdrop is informed of the
  194. X * changes to the parameters.
  195. X *
  196. X */
  197. X
  198. Xvoid main(argc,argv)
  199. Xint argc;
  200. Xchar *argv[];
  201. X{
  202. X    int quit = NO, error = NO;
  203. X    UWORD n,i,j;
  204. X    MyMP *myport;
  205. X    struct Task *FindTask(), *othertask;
  206. X    char *p;
  207. X    int doback();
  208. X    void resloop();
  209. X    BPTR stdout;
  210. X
  211. X    stdout = Output();
  212. X    Write(stdout,usage1,sizeof(usage1));
  213. X
  214. X    /*   Check to see if we are already running. If we are, initialise
  215. X     *   contents of our local port structure with the current contents,
  216. X     *   else initialise them to default values.
  217. X     */
  218. X
  219. X    if ((myport = (MyMP *)FindPort(Portname)) == NULL) {
  220. X        /* --- First time being run --- */
  221. X        port.foreground = 1;                     /* Default pen colour     */
  222. X        port.background = 0;                     /* Default background col */
  223. X        port.windowflags = SMART_REFRESH | WINDOWFLAGS;     /* Window type    */
  224. X        port.pat = Patterns[0];                     /* Default pattern        */
  225. X        port.mp.mp_Node.ln_Name = Portname;      /* Set the port name      */
  226. X        port.mp.mp_SigBit = AllocSignal(-1L);     /* Get signal # for port  */
  227. X    } else {
  228. X        /* --- Already running a copy --- */
  229. X        port = *myport;    /* Get copy of current contents */
  230. X    }
  231. X
  232. X    /* Now parse command line, updating parameters as necessary */
  233. X
  234. X    while (argc > 1) {
  235. X        if (argv[1][0] == '-') {
  236. X            n = atoi(&argv[1][2]);    /* Get possible second parameter */
  237. X            switch (tolower(argv[1][1])) {
  238. X                case 'a':
  239. X                    port.foreground = n;
  240. X                    break;
  241. X                case 'b':
  242. X                    port.background = n;
  243. X                    break;
  244. X                case 'p':
  245. X                    if (n < 0 || n > NUMPATS-1)
  246. X                        n = 0;
  247. X                    port.pat = Patterns[n];
  248. X                    break;
  249. X                case 'q':
  250. X                    quit = YES;
  251. X                    break;
  252. X                case 'f':
  253. X                    port.windowflags = WINDOWFLAGS | SMART_REFRESH;
  254. X                    break;
  255. X                case 's':
  256. X                    port.windowflags = WINDOWFLAGS | SIMPLE_REFRESH;
  257. X                    break;
  258. X                default:
  259. X                    error = YES;
  260. X                    break;
  261. X            }
  262. X        } else if ((strlen(p = argv[1])) == 16) {
  263. X            /* Convert 16 digit hex value into pattern */
  264. X            for (i = 0; i < 8; i++) {
  265. X                for (n = 0, j = 0; j < 2; j++,p++) {
  266. X                    n = n<<4 | htoi(*p);
  267. X                }
  268. X                port.pat.value[i] = n<<8 | n;
  269. X            }
  270. X        } else
  271. X            error = YES;
  272. X
  273. X        if (error) {
  274. X            Write(stdout,usage2,sizeof(usage2));
  275. X            Write(stdout,usage3,sizeof(usage3));
  276. X            exit(10);
  277. X        }
  278. X        argv++;
  279. X        argc--;
  280. X    }
  281. X
  282. X    /*   Now local copy of port contains an up-to-date copy of the
  283. X     *   current settings
  284. X     */
  285. X
  286. X    if (myport == NULL) {
  287. X        /* --- First time being run --- */
  288. X        if (quit)
  289. X            exit(10);    /* No work to do if backdrop not active already */
  290. X        AddPort(&port);                             /* Make our port public  */
  291. X        /* Detach this process from CLI, and setup process ID in port    */
  292. X        if (!res("Backdrop",4,resloop,4000))
  293. X            RemPort(&port);
  294. X        exit(0);
  295. X    } else {
  296. X        othertask = myport->mp.mp_SigTask;
  297. X
  298. X        /* If quit, tell the other copy to quit */
  299. X        if (quit) {
  300. X            Signal(othertask, SIGBREAKF_CTRL_C);
  301. X            exit(0);
  302. X        }
  303. X
  304. X        /* Else we have a new pattern to install */
  305. X        Forbid();    /* Stop other copy trying to access the array */
  306. X        *myport = port; /* Copy updated parameters back to global store */
  307. X        Permit();
  308. X        Signal(othertask, SIGBREAKF_CTRL_F); /* Force screen update */
  309. X        exit(0);
  310. X    }
  311. X}
  312. X
  313. X/*
  314. X * This is the main loop. It just keeps looping around, until it is told
  315. X * to exit (via a special return value from doback()). When it returns,
  316. X * it actually is returning to AmigaDOS() which will then remove it from
  317. X * the system.
  318. X *
  319. X */
  320. Xvoid resloop()
  321. X{
  322. X    port.mp.mp_SigTask = FindTask(0L);    /* Set pointer to our task */
  323. X    while (doback() == REPEAT)         /* Do intuition stuff      */
  324. X        ;
  325. X    /* We got some kind of exit code, so clean up */
  326. X    RemPort(&port);    /* Kill our public port  */
  327. X}
  328. X
  329. X/*
  330. X * This routine is where all the actual work gets done. A backdrop window
  331. X * is opened on the workbench screen, and filled with the current pattern.
  332. X * Then it waits for messages from Intuition saying the window needs to be
  333. X * refreshed, and for signals from other invocations of Backdrop. A CTRL-C
  334. X * signal causes Backdrop to remove itself, and CTRL-F forces the screen
  335. X * to be updated. The return value is an error code, in case some resources
  336. X * couldn't be allocated (0 or 10).
  337. X *
  338. X */
  339. X
  340. X#define OLIB(a,b) ((a = (struct a *)OpenLibrary(b,33L)) == NULL)
  341. X
  342. Xint doback()
  343. X{
  344. X    struct Window *win;
  345. X    struct RastPort *rp;
  346. X    struct Screen *scr;
  347. X    IM *msg;
  348. X    int err = 10, xmax, ymax,;
  349. X    ULONG signal,lock;
  350. X
  351. X    if (OLIB(IntuitionBase,"intuition.library"))
  352. X        goto err1;
  353. X
  354. X    if (OLIB(GfxBase,"graphics.library"))
  355. X        goto err2;
  356. X
  357. X    /* Now find the maximum size for our window by peeking at the dimensions
  358. X     * of the Workbench screen. If no workbench screen is open, we exit.
  359. X     */
  360. X    lock = LockIBase(0L);
  361. X    for (scr = IntuitionBase->FirstScreen; scr; scr = scr->NextScreen) {
  362. X        if ((scr->Flags & SCREENTYPE) == WBENCHSCREEN) {
  363. X            xmax = scr->Width;
  364. X            ymax = scr->Height;
  365. X            break;
  366. X        }
  367. X    }
  368. X    UnlockIBase(lock);
  369. X
  370. X    if (scr == NULL)
  371. X        goto err2;    /* If couldn't find workbench screen, we fail */
  372. X
  373. X    nw.Width  = xmax;
  374. X    nw.Height = ymax;
  375. X    nw.Flags  = port.windowflags;
  376. X
  377. X    if ((win = OpenWindow(&nw)) == NULL)
  378. X        goto err3;
  379. X
  380. X    err = 0;    /* Everything opened ok, so indicate no error */
  381. X    rp = win->RPort;
  382. X    SetDrMd(rp,JAM2);
  383. X    SetAfPt(rp,&port.pat.value[0],3);    /* Set area pattern */
  384. X
  385. X
  386. X#define IDCMPMASK (1<<win->UserPort->mp_SigBit)
  387. X#define CTRL_C (SIGBREAKF_CTRL_C)
  388. X#define CTRL_F (SIGBREAKF_CTRL_F)
  389. X
  390. X    while (1) {
  391. X        SetAPen(rp,port.foreground);
  392. X        SetBPen(rp,port.background);
  393. X        RectFill(rp,0,0,xmax,ymax);
  394. X        signal = Wait(CTRL_C | CTRL_F | IDCMPMASK);
  395. X
  396. X        /* If we got a CTRL_C, break out of this loop */
  397. X        if (signal & CTRL_C)
  398. X            break;
  399. X
  400. X        /* Else was CTRL_F or a refresh event from Intuition */
  401. X
  402. X        if (signal & IDCMPMASK) {
  403. X            /* Flush Intuition messages */
  404. X            while ((msg = (IM *)GetMsg(win->UserPort)) != NULL)
  405. X                ReplyMsg((APTR)msg);
  406. X        }
  407. X
  408. X        /* Now check if user wants a different sort of window type */
  409. X
  410. X        if (nw.Flags != port.windowflags) {
  411. X            err = REPEAT;    /* Indicate we want to reopen window */
  412. X            break;
  413. X        }
  414. X        /* Else loop back to start, and force redraw of window */
  415. X    }
  416. X
  417. X    /* We get down to here if a CTRL_C is received */
  418. X
  419. X    err4:
  420. X        CloseWindow(win);
  421. X
  422. X    err3:
  423. X        CloseLibrary(GfxBase);
  424. X
  425. X    err2:
  426. X        CloseLibrary(IntuitionBase);
  427. X
  428. X    err1:
  429. X        return(err);
  430. X}
  431. X
  432. X/*
  433. X *   These definitions just stop the corresponding library routines getting
  434. X *   pulled in, which helps keep the code size down.
  435. X */
  436. X
  437. Xint brk(){return(0);}
  438. Xvoid MemCleanup(){}
  439. Xvoid chkabort(){}
  440. SHAR_EOF
  441. echo "extracting atoi.a"
  442. sed 's/^X//' << \SHAR_EOF > atoi.a
  443. X* :ts=8
  444. X*
  445. X* A very simple function which simply converts an ASCII string to its numeric
  446. X* equivalent. It is MUCH smaller than it's equivalent in the Lattice
  447. X* library.
  448. X*
  449. X
  450. X    xdef    atoi
  451. X
  452. X    csect   text,0,0,1,2
  453. X
  454. Xatoi:
  455. X    moveq    #0,d0            ; Initialise integer to 0
  456. X    moveq    #0,d1            ; Initialise temporary variable
  457. X    move.l    4(a7),a0        ; Get pointer to string
  458. Xloop:
  459. X    move.b    (a0)+,d1        ; Get next character from string
  460. X    subi.b    #$30,d1            ; Convert to range 0-9
  461. X    cmpi.b    #10,d1            ; If outside range,
  462. X    bhi.s    exit            ; then return to caller
  463. X    mulu    #10,d0            ; Update count
  464. X    add.l    d1,d0            ; Add in new digit
  465. X    bra.s    loop            ; And go back for next digit
  466. Xexit:
  467. X    rts                ; Return with number in D0
  468. X
  469. X    end
  470. SHAR_EOF
  471. echo "extracting res.a"
  472. sed 's/^X//' << \SHAR_EOF > res.a
  473. X*:ts=8
  474. X*****************************************************************************
  475. X*                                                                           *
  476. X* RES.A                                    (C) Copyright Eddy Carroll 1989  *
  477. X*                                                                           *
  478. X* This module allows you to make a duplicate copy of your current process.  *
  479. X* In fact, both processes actually share the same code. However, the        *
  480. X* seglist pointer of the current process is modified so that when the       *
  481. X* process terminates, the memory doesn't get freed (if it did, the new      *
  482. X* process would suddenly find itself deallocated. Hello guru...)            *
  483. X* This code only works when called from CLI processes.                      *
  484. X*                                                                           *
  485. X* The parameters passed are similar to those for CreateProc(), with the     *
  486. X* difference that instead of passing a BPTR to a seglist, you pass the      *
  487. X* address of the function the new process should start executing at.        *
  488. X*                                                                           *
  489. X* When the new process returns from this function, it will be removed from  *
  490. X* the system, and its memory (finally) deallocated.                         *
  491. X*                                                                           *
  492. X* The typical use for a function like this is to allow a program to detach  *
  493. X* itself from a CLI (completely, with no trailing console handles etc.)     *
  494. X* when it is run. This is a convenient feature for the user, if the program *
  495. X* is of the sort designed to sit in the background the whole time, rather   *
  496. X* than do something immediately, then exit.                                 *
  497. X*                                                                           *
  498. X* Lattice provide cback.o which on first look would seem to provide a       *
  499. X* similar solution. However, cback.o makes it difficult to print error      *
  500. X* messages to the console if there is an error on the command line - by     *
  501. X* the time you spot the error, the CLI prompt has already been printed      *
  502. X* and your error message is printed after it. This looks very messy.        *
  503. X* In addition, cback.o doesn't let you shut the CLI window after detaching  *
  504. X* a process, which can be annoying. res doesn't suffer from any such        *
  505. X* inhibitions.                                                              *
  506. X*                                                                           *
  507. X* From C, you call it as follows:                                           *
  508. X*                                                                           *
  509. X* pid = res(name,pri,func,stacksize)                                        *
  510. X*                                                                           *
  511. X* name         - pointer to null terminated string                          *
  512. X* pri          - integer, priority of the new process                       *
  513. X* func         - pointer to the function for new process to call            *
  514. X* stacksize    - integer, size of the stack for the new process             *
  515. X*                                                                           *
  516. X* pid          - Process ID of new process, or 0 if none created            *
  517. X*                                                                           *
  518. X*****************************************************************************
  519. X
  520. X    INCLUDE "exec/types.i"
  521. X        INCLUDE "exec/alerts.i"
  522. X        INCLUDE "exec/nodes.i"
  523. X        INCLUDE "exec/lists.i"
  524. X        INCLUDE "exec/ports.i"
  525. X        INCLUDE "exec/libraries.i"
  526. X        INCLUDE "exec/tasks.i"
  527. X        INCLUDE "libraries/dos.i"
  528. X        INCLUDE "libraries/dosextens.i"
  529. X        INCLUDE "workbench/startup.i"
  530. X        INCLUDE "exec/funcdef.i"
  531. X        INCLUDE "exec/exec_lib.i"
  532. X        INCLUDE "libraries/dos_lib.i"
  533. X
  534. X    xref    SysBase
  535. X    xref    DOSBase
  536. X    xdef    res
  537. X
  538. XAbsExecBase    equ    4
  539. Xsegsize        equ    36        ; Size of fake seg. (code = 28 bytes)
  540. X
  541. X        csect   text,0,0,1,2        * xref's after this are 16-bit reloc
  542. X
  543. X    xref    exit
  544. X
  545. Xcallsys macro
  546. X        CALLLIB _LVO\1
  547. X    endm
  548. X
  549. X
  550. Xres:
  551. X    movem.l    d2-d4/a2/a3/a6,-(a7)    ; Save registers
  552. X    move.l    AbsExecBase.w,a6    ; Get base of Exec library
  553. X    moveq    #0,d1            ; Any sort of memory will do
  554. X    moveq    #segsize,d0        ; Get size of fake segment
  555. X    callsys    AllocMem        ; Grab some memory
  556. X    tst.l    d0            ; Did we get any?
  557. X    beq    fatal            ; If not, abort immediately!
  558. X    move.l    d0,a3            ; Save pointer to memory
  559. X    sub.l    a1,a1            ; NULL pointer indicates our process
  560. X    callsys    FindTask        ; Get pointer to our process block
  561. X    move.l    d0,a2            ; Save it
  562. X    move.l    pr_CLI(A2),a0        ; Get BPTR to our process's segarray
  563. X    add.l    a0,a0            ; Convert BPTR to address
  564. X    add.l    a0,a0            ; 
  565. X    move.l    cli_Module(a0),4(a3)    ; Make fake segment point to our code
  566. X    clr.l    cli_Module(a0)        ; Remove process seg. from CLI seglist
  567. X    move.l    #segsize,(a3)        ; Set size of fake seglist
  568. X    lea.l    8(a3),a2        ; Get pointer to first code byte
  569. X
  570. X;
  571. X; Now a tiny machine code program is constructed. It looks like this:
  572. X;
  573. X;    move.l    #$xxxxxx,A4    ; Initialise A4
  574. X;    jsr    $xxxxxx        ; Call user program
  575. X;    move.l    #$xxxxxx,A6    ; Load DOSbase into A6
  576. X;    move.l    #$xxxxxx,d1    ; Get BPTR to this segment 
  577. X;    jmp    UnLoadSeg(A6)    ; Unload our process from memory
  578. X;
  579. X; It's built "on the fly" so to speak, to keep code size down, and also
  580. X; because it's a convenient way of initialising all the variables.
  581. X; Note that a potential problem exists if DOSBase should somehow alter or
  582. X; disappear. We'll assume it will remain relatively stable for the next
  583. X; few years anyway :-)
  584. X;
  585. X
  586. X    move.l    DOSBase,a6        ; Prepare for DOS call
  587. X    move.w    #$287C,(a2)+        ; Store MOVE.L $xxxxxx,A4 instruction
  588. X    move.l    a4,(a2)+        ; Output value of A4 to initialise to
  589. X    move.w    #$4EB9,(a2)+        ; Store JSR $xxxxxx
  590. X    move.l    36(a7),(a2)+        ; followed by address of user function
  591. X    move.w    #$2C7C,(a2)+        ; Store MOVE.L $xxxxxx,A6 instruction
  592. X    move.l    a6,(a2)+        ; followeds by current DOSbase
  593. X;
  594. X    lea    4(a3),a3        ; Now get seglist ptr to fake segment
  595. X    move.l    a3,d3            ; and convert it to BPTR
  596. X    lsr.l    #2,d3            ; D3 now has seglist ptr to fake seg
  597. X    move.w    #$223C,(a2)+        ; Store MOVE.L $xxxxxx,D1 instruction
  598. X    move.l    d3,(a2)+        ; Followed by BPTR to the segment
  599. X    move.l    #$4EEEFF64,(a2)+    ; Store JMP UnLoadSeg(A6)
  600. X;
  601. X    move.l    28(A7),d1        ; Get pointer to name
  602. X    move.l    32(A7),d2        ; Get process priority
  603. X    move.l    40(A7),d4        ; Get stacksize
  604. X    move.l    d1,$03f0
  605. X    callsys    CreateProc        ; Create new process
  606. X    movem.l    (a7)+,d2-d4/a2/a3/a6    ; Pop registers
  607. X    rts                ; Return
  608. Xfatal:
  609. X    moveq    #120,d0            ; Set error exit code
  610. X    jmp    exit            ; And exit
  611. X
  612. X    end
  613. SHAR_EOF
  614. echo "extracting tiny.a"
  615. sed 's/^X//' << \SHAR_EOF > tiny.a
  616. X*:ts=8
  617. X****************************************************************************
  618. X*                                                                          *
  619. X* TINY.A                                  (C) Copyright Eddy Carroll 1989  *
  620. X* ~~~~~~                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  *
  621. X*                                                                          *
  622. X* This is a rewrite of the startup code provided with Lattice C V4.0.      *
  623. X* It is a "bare bones" version, which is substantially smaller, and also   *
  624. X* allows programs to be linked without needing to access lc.lib (unless    *
  625. X* of course they are using functions in lc.lib). Only CLI programs are     *
  626. X* supported, and no default i/o channels or other lattice-specific stuff   *
  627. X* are initialised. exit() doesn't automatically clean up any more, so      *
  628. X* don't use things like malloc() and fopen() unless you call free() and    *
  629. X* fclose() yourself. This replacement is designed for programs that go     *
  630. X* directly to AmigaDOS and Exec, rather than through the Unix-like Lattice *
  631. X* functions.                                                               *
  632. X*                                                                          *
  633. X* All in all, this version shaves around 1500 bytes off the size of a C    *
  634. X* program. No guarantees are supplied as regards its suitability for any   *
  635. X* particular use, other than it works for me.                              *
  636. X*                                                                          *
  637. X* Using it is very simple: Simply modify the command line for BLINK from   *
  638. X* BLINK FROM LIB:C.O+.... to BLINK FROM TINY.O+... and leave everything    *
  639. X* else the same.                                                           *
  640. X*                                                                          *
  641. X* Note that when assembling this, make sure to specify the -u switch on    *
  642. X* the Lattice assembler's command line. This adds a '_' to all symbols     *
  643. X* defined. If you are using a different assembler, you need to add a '_'   *
  644. X* manually yourself.                                                       *
  645. X*                                                                          *
  646. X****************************************************************************
  647. X
  648. X        INCLUDE "exec/types.i"
  649. X        INCLUDE "exec/alerts.i"
  650. X        INCLUDE "exec/nodes.i"
  651. X        INCLUDE "exec/lists.i"
  652. X        INCLUDE "exec/ports.i"
  653. X        INCLUDE "exec/libraries.i"
  654. X        INCLUDE "exec/tasks.i"
  655. X        INCLUDE "libraries/dos.i"
  656. X        INCLUDE "libraries/dosextens.i"
  657. X        INCLUDE "workbench/startup.i"
  658. X        INCLUDE "exec/funcdef.i"
  659. X        INCLUDE "exec/exec_lib.i"
  660. X        INCLUDE "libraries/dos_lib.i"
  661. X
  662. XMAXARGS        EQU 32    ; Maximum number of command line arguments from CLI
  663. XAbsExecBase EQU 4    ; Welcome to the only fixed point in the universe
  664. X
  665. X* A useful macro to let us call library routines
  666. Xcallsys macro
  667. X        CALLLIB _LVO\1
  668. X        endm
  669. X        
  670. X        xdef    XCEXIT            * exit(code) is standard way to exit C.
  671. X    xdef    exit                    *
  672. X
  673. X        xref    LinkerDB            * linker defined base value
  674. X        xref    _BSSBAS            * linker defined base of BSS
  675. X        xref    _BSSLEN            * linker defined length of BSS
  676. X
  677. X*       library references
  678. X
  679. X        csect   text,0,0,1,2        * xref's after this are 16-bit reloc
  680. X
  681. X        xref    main            * Name of C program to start with.
  682. X
  683. Xstart:
  684. X        movem.l d1-d6/a0-a6,-(a7)
  685. XREGSIZE EQU     (6+7)*4
  686. X        lea     REGSIZE(a7),A5         * Determine old stack pointer
  687. X        move.l  a0,a2                  * Save command pointer
  688. X        move.l  d0,d2                  * and command length
  689. X        lea     LinkerDB,a4            * Load base register
  690. X
  691. X        move.l  AbsExecBase.W,a6
  692. X        move.l  a6,SysBase(A4)
  693. X        move.l  a7,_StackPtr(A4)       * Save stack ptr
  694. X
  695. X    suba.l    a1,a1
  696. X    callsys    FindTask           * Find out our task ID
  697. X    move.l    d0,a3
  698. X
  699. X*=======================================================================
  700. X*====== CLI Startup Code ===============================================
  701. X*=======================================================================
  702. X*
  703. X* Entry: D2 = command length
  704. X*        A2 = Command pointer
  705. XfromCLI:
  706. X        move.l  a5,D0           * get top of stack
  707. X        sub.l   4(a5),D0        * compute bottom 
  708. X        add.l   #128,D0         * allow for parms overflow
  709. X        move.l  D0,_base(A4)    * save for stack checking
  710. X*-----------------------------------------------------------------------
  711. X*  Open the DOS library:
  712. X
  713. XopenDOS
  714. X    lea     DOSName(A4),A1
  715. X    moveq.l #0,D0
  716. X    callsys OpenLibrary
  717. X    move.l  D0,DOSBase(A4)
  718. X    bne    getcom
  719. XnoDOS:
  720. X    moveq.l #100,d0
  721. X    bra     exit2
  722. X
  723. X*------ find command name:
  724. Xgetcom:
  725. X    move.l  pr_CLI(a3),a0
  726. X        add.l   a0,a0           * bcpl pointer conversion
  727. X        add.l   a0,a0
  728. X        move.l  cli_CommandName(a0),a1
  729. X        add.l   a1,a1           * bcpl pointer conversion
  730. X        add.l   a1,a1
  731. X
  732. X*------ collect parameters:
  733. X        move.l  d2,d0                   * get command line length
  734. X        moveq.l #0,d1
  735. X        move.b  (a1)+,d1
  736. X        move.l  a1,_ProgramName(A4)
  737. X        add.l   d1,d0                   * add length of command name
  738. X        addq.l  #1,d0                   * allow for space after command 
  739. X
  740. X        clr.w   -(A7)                   * set null terminator for command line
  741. X        addq.l  #1,D0                   * force to even number of bytes
  742. X        andi.w  #$fffe,D0               * (round up)
  743. X        sub.l   D0,A7                   * make room on stack for command line
  744. X        subq.l  #2,D0
  745. X        clr.w   0(A7,D0)
  746. X
  747. X*------ copy command line onto stack
  748. X        move.l  d2,d0                   * get command line length
  749. X        subq.l  #1,d0
  750. X        add.l   d1,d2
  751. X
  752. Xcopy_line:
  753. X        move.b  0(A2,D0.W),0(A7,D2.W)   * copy command line to stack
  754. X        subq.l  #1,d2
  755. X        dbf     d0,copy_line
  756. X        move.b  #' ',0(a7,d2.w)         * add space between command and parms
  757. X        subq.l  #1,d2
  758. X
  759. Xcopy_cmd:
  760. X        move.b  0(a1,d2.w),0(a7,d2.w)    * copy command name to stack
  761. X        dbf     d2,copy_cmd
  762. X    move.l    a7,a1            * Get pointer to new command line
  763. X
  764. X    sub.l    #(MAXARGS*4),a7        * Reserve space for argv[]
  765. X    move.l    a7,a2            * Initialise base into array
  766. X    move.l    a2,a3            * Save base of argv
  767. X    moveq    #0,d2            * Initialise argc
  768. X
  769. X*
  770. X* From here on down, A1 is pointer into command line
  771. X*
  772. Xbuild_argv:
  773. X    bsr.s    getnext            * Read next character from line
  774. X    bcs.s    doquote            * If quote, handle
  775. X    beq.s    build_argv        * If white space, skip over it
  776. X
  777. X    lea    -1(a1),a0        * Get address of this parameter
  778. X    bsr.s    bumpargv        * Store it to argv[] array
  779. Xbuild_2:
  780. X    bsr.s    getnext            * Get next character
  781. X    bne.s    build_2            * If not white space, keep looking
  782. X    clr.b    -1(a1)            * Zero-terminate current argument
  783. X    bra.s    build_argv        * And go back to get next argument
  784. X
  785. Xdoquote:
  786. X    move.l    a1,a0            * Get pointer to this argument
  787. X    bsr.s    bumpargv        * Output it to argv[]
  788. Xquote_2:
  789. X    bsr.s    getnext            * Get next character
  790. X    bcc.s    quote_2            * If not quote, keep looking
  791. X    clr.b    -1(a1)            * Zero-terminate current argument
  792. Xquote_3:
  793. X    bsr.s    getnext            * Get next character
  794. X    bne.s    quote_3            * Skip until space reached
  795. X    beq.s    build_argv        * Go back and read next argument
  796. X
  797. Xbumpargv:
  798. X    move.l    a0,(a2)+        * Output ptr to current argument
  799. X    addq    #1,d2            * Increment argc
  800. X    cmpi    #MAXARGS,d2        * Used up all our arguments yet?
  801. X    bls.s    qrts            * If not, then return
  802. X    moveq    #110,d0            * Else set return code
  803. X    bra.s    exit2            * And exit
  804. X
  805. X*
  806. X* Reads next character from command line. If zero, never returns, but
  807. X* drops into call to main. Else, returns, with C=1 if character is quote,
  808. X* Z=1 if character is white space.
  809. X*
  810. Xgetnext:
  811. X    move.b    (a1)+,d0        * Get character from command line
  812. X    beq.s    get_2            * Exit if end of line
  813. X    cmp.b    #34,d0            * Check if quote
  814. X    beq.s    isquote            * 
  815. X    cmp.b    #32,d0            * Check if space
  816. X    beq.s    isspace            *
  817. X    cmp.b    #9,d0            * Or tab
  818. X    beq.s    isspace            *
  819. X    cmp.b    #10,d0            * Or end of line
  820. Xisspace:
  821. X    andi    #$1E,ccr        * Clear carry flag, retaining Z
  822. Xqrts    rts
  823. X
  824. Xisquote:
  825. X    ori    #1,ccr            * Set carry flag
  826. X    andi    #$FB,ccr        * Clear zero flag
  827. X    rts                * And return
  828. X
  829. Xget_2:
  830. X    move.l    a3,-(a7)        * Push argv onto stack
  831. X    move.l    d2,-(a7)        * Push argc onto stack
  832. X
  833. X        lea     _BSSBAS,a3          * get base of BSS
  834. X        moveq   #0,d1
  835. X        move.l  #_BSSLEN,d0         * get length of BSS in longwords
  836. X        bra.s   clr_lp              * and clear for length given
  837. Xclr_bss move.l  d1,(a3)+
  838. Xclr_lp  dbf     d0,clr_bss
  839. X
  840. Xdomain:
  841. X    jsr    main(PC)        * Call main(argc,argv)
  842. X        moveq.l #0,d0               * Set successful status
  843. X        bra.s   exit2
  844. X
  845. Xexit:
  846. X_exit:
  847. XXCEXIT:
  848. X        move.l  4(SP),d0        * Extract return code
  849. Xexit2:
  850. X        move.l  d0,-(a7)
  851. X        move.l  AbsExecBase.W,a6
  852. X        move.l  DOSBase(A4),a1
  853. X        callsys CloseLibrary            * Close Dos library
  854. X
  855. X*------ this rts sends us back to DOS:
  856. XexitToDOS:
  857. X        MOVE.L  (A7)+,D0
  858. X        movea.l _StackPtr(a4),SP        * Restore stack ptr
  859. X        movem.l (a7)+,d1-d6/a0-a6
  860. X        rts
  861. X
  862. X*-----------------------------------------------------------------------
  863. X* Global definitions
  864. X*
  865. X        csect   __MERGED,1,,2,2
  866. X*
  867. X        xdef    NULL,SysBase,LoadAddress,DOSBase
  868. X        xdef    _oserr,_OSERR,_ONBREAK
  869. X        xdef    _ProgramName,_StackPtr,_base
  870. X*
  871. XNULL           dc.l    0
  872. X_base          dc.l    0
  873. X_oserr         equ     *
  874. X_OSERR         dc.l    0
  875. X_ONBREAK       dc.l    0
  876. XSysBase        dc.l    0
  877. XLoadAddress    dc.l    0
  878. X_StackPtr      dc.l    0
  879. XDOSBase        dc.l    0
  880. X_ProgramName   dc.l    0
  881. XDOSName        dc.b    'dos.library',0
  882. X
  883. X        END
  884. SHAR_EOF
  885. echo "extracting Makefile"
  886. sed 's/^X//' << \SHAR_EOF > Makefile
  887. X#
  888. X# Aztec Make makefile, for Lattice C V4.0 :-)
  889. X#
  890. X# Backdrop (C) Copyright Eddy Carroll, April 1989
  891. X#
  892. X
  893. XZOOEXE = backdrop backdrop.doc README System-Configuration
  894. XZOOSRC = backdrop.c backdrop.n tiny.a res.a atoi.a tiny.o res.o atoi.o makefile
  895. XOBJS   = tiny.o res.o atoi.o backdrop.o
  896. X
  897. X
  898. X.c.o:
  899. X    lc -s -v $*.c
  900. X.a.o:
  901. X    sys:lattice/c/asm -isys:include/ -u $*.a
  902. X.n.doc:
  903. X    nro >$*.doc -ms:an $*.n
  904. X
  905. X
  906. Xall: backdrop backdrop.doc
  907. X
  908. Xbackdrop: $(OBJS)
  909. X    blink from $(OBJS) to backdrop sc sd nd map ram:map lib lib:amiga.lib
  910. X
  911. Xtiny.o:    tiny.a
  912. Xres.o:    res.a
  913. Xatoi.o:    atoi.a
  914. X
  915. Xbackdrop.o:      backdrop.c
  916. Xbackdrop.doc: backdrop.n
  917. X
  918. Xzoo:    backdrop.zoo
  919. Xzoosrc: backdropsrc.zoo
  920. X
  921. Xbackdrop.zoo: $(ZOOEXE)
  922. X    -delete Backdrop.zoo
  923. X    zoo a Backdrop.zoo $(ZOOEXE)
  924. X
  925. Xbackdropsrc.zoo: $(ZOOSRC)
  926. X    -delete BackdropSrc.zoo
  927. X    zoo a BackdropSrc.zoo $(ZOOSRC)
  928. X
  929. Xclean:
  930. X    -delete "#?.bak"
  931. SHAR_EOF
  932. echo "extracting Sys-Conf.uu"
  933. sed 's/^X//' << \SHAR_EOF > Sys-Conf.uu
  934. X
  935. Xbegin 644 System-Configuration
  936. XM"````@```````)'U```````([)(````!``>A(````````/P`?`#^`'P`A@!X/
  937. XM`(P`?`"&`&X`DP`'`&F``X`$P`'``F``@`%`````@```````````````````J
  938. XM`````````````/\````&9@S,``$%50```S,$1.CO`($`+`````!%<'-O;EA;8
  939. XM0T)-7TU04RTQ,C4P70```````````````````````0!0```````!``(```!")
  940. XM````0``I17!S;VY86T-"35]-4%,M,3(U,%T`````````````&$`9(``````'L
  941. X'`````````'!SC
  942. X``
  943. Xend
  944. Xsize 232
  945. SHAR_EOF
  946. echo "extracting backdrop.uu"
  947. sed 's/^X//' << \SHAR_EOF > backdrop.uu
  948. X
  949. Xbegin 644 backdrop
  950. XM```#\P`````````"``````````$```'P````]@```^D```'P2.=^_DOO`#0DZ
  951. XM2"0`2?D`````+'@`!"E.`!`I3P`8D\E.KO[:)D`@#9"M``0&@````(`I0``$D
  952. XM0^P`)'``3J[]V"E``!QF```(<&1@``#H(&L`K-'(T<@B:``0T\G3R2`"<@`2$
  953. XM&2E)`"#0@5*`0F=2@`)`__Z?P%6`0G<(`"`"4X#4@1^R```@`%."4<C_]A^\V
  954. XM`"`@`%."'[$@`"``4<K_^")/G_P```"`)$\F2G0`831E$F?Z0>G__V$<82AF;
  955. XM_$(I__]@ZB!)80YA&F3\0BG__V$29OQGV"3(4D(,0@`@8R)P;F!0$!EG)@P`B
  956. XM`")G%@P``"!G"@P```EG!`P```H"/``>3G4`/``!`CP`^TYU+PLO`D?Y```#8
  957. XMF'(`(#P````08`(FP5'(__Q.N@#6<`!@!"`O``0O`"QX``0B;``<3J[^8B`?T
  958. XM+FP`&$S??WY.=0``2.<X,BQX``1R`'`D3J[_.DJ`9P``<B9`D\E.KO[:)$`@6
  959. XM:@"LT<C1R"=H`#P`!$*H`#PFO````"1%ZP`(+'D````<-/PH?"3,-/Q.N23O*
  960. XM`"0T_"Q\),Y'ZP`$)@ODBS3\(CPDPR3\3N[_9"(O`!PD+P`@*"\`*"/!```#^
  961. XM\$ZN_W9,WTP<3G5P>$[Y```!,```<`!R`"!O``02&`0!`#`,`0`*8@C`_``*R
  962. XMT(%@[$YU``!.5?_B2.<P`G``*T#_^"M`__PL;``<3J[_Q"M`_^(B+?_B0>P`9
  963. XM-"0(=DTL;``<3J[_T$/L`?`L>``$3J[^>BM`_^Y*K?_N9CH9?``!`]9"+`/7Q
  964. XM*7P```D``])![`'Z0^P#PB+8(M@BV"+80>P!\"E(`ZIP_RQX``1.KOZV&4`#F
  965. XMKV`0(&W_[D/L`Z!P#2+84<C__`RM`````0`(;P`"`B)M``P@:0`$$!`,```ML
  966. XM9@`!`%2(+PA.NO\J6$\B;0`,(&D`!")(4HD2$3M`__8,`0!!;1@,`0!:;A(BN
  967. XM2%*)$!%(@$C`!H`````@8`A2B!`02(!(P'(P!$$`"&L``*JPNQ`(9O).^Q`&J
  968. XM````<V```(P```!F8```>````'%@``!F````<&```"H```!B8```%@```&%@G
  969. XM```","W_]AE``]9@``$2,"W_]AE``]=@``$&,BW_]@Q!``!E!@Q!`!)C!G``I
  970. XM.T#_]C`M__9(P.F`0>P!^M'`0^P#PB+8(M@BV"+88```TG`!*T#__&```,@IB
  971. XM?```"0`#TF```+PI?```"4`#TF```+!P`2M`__A@``"F(FT`#"!I``0B2$H97
  972. XM9OQ3B9/(*TC_YK+\`!!F``""0FW_]`QM``C_]&1Z<``[0/_R.T#_]@QM``+_1
  973. XM\F1"<``P+?_VZ8`@;?_F$A!(@4C!#!``05S"1`)(@DC")@+GBY:"DH,$@0``*
  974. XM`#`"@0````^`@3M`__92;?_R4JW_YF"V,"W_]$C`T(!![`/"T<`P+?_V(@#A=
  975. XM08)`,(%2;?_T8(1P`2M`__A*K?_X9SHB+?_B0>P`@20()CP```"<+&P`'$ZND
  976. XM_]`B+?_B0>P!'20()CP```#3+&P`'$ZN_]!(>``*3KK\HEA/6*T`#%.M``A@Z
  977. XM`/WV2JW_[F9.2JW__&<*2'@`"DZZ_(!83T/L`Z`L>``$3J[^GDAX#Z!(>@":`
  978. XM2'@`!$AL`VI.NOQ^3^\`$$J`9@Q#[`.@+'@`!$ZN_IA"ITZZ_$183V!F(FW_I
  979. XM[B!I`!`K2/_J2JW__&<:(FW_ZB`\```0`"QX``1.KOZ\0J=.NOP66$\L>``$J
  980. XM3J[_?$'L`Z`B;?_N<`TBV%'(__PL>``$3J[_=B)M_^H@/```@``L>``$3J[^=
  981. XMO$*G3KK[W%A/3-]`#$Y=3G5(YP`"D\DL>``$3J[^VBE``[!A&@R````G#V?V/
  982. XM0^P#H"QX``1.KOZ83-]``$YU3E7_V$CG(`)P"BM`_^Q#[`-T<"$L>``$3J[]M
  983. XMV"E``YA*K`.89P`!V$/L`X9P(2QX``1.KOW8*4`#G$JL`YQG``&R<``L;`.8)
  984. XM3J[^8BM`_]P@;`.8*V@`//_T2JW_]&<P(&W_]#`H`!0"0``/4T!F%C`H``Q($
  985. XMP#(H``Y(P2M`_^@K0?_D8`H@;?_T*U#_]&#*(&W_W"QL`YA.KOY<2JW_]&<`6
  986. XM`5`@+?_H.4`#/B`M_^0Y0`-`*6P#T@-(0>P#.BQL`YA.KO\T*T#__$JM__QGK
  987. XM``$60JW_[")M__P@:0`R*TC_^")M__AP`2QL`YQ.KOZ>0>P#PB)M__@C2``(1
  988. XM$WP``P`=<``0+`/6+T``"")M__@@+P`(+&P#G$ZN_JIP`!`L`]<O0``((FW_N
  989. XM^"`O``@L;`.<3J[^I"\M_^0O+?_H<``O`"\`+RW_^$ZZ`,A/[P`4(FW__"!I\
  990. XM`%9P`!`H``]R`20!X:(`@@``D``@`BQX``1.KO["*T#_X`@M``3_XF9:(FW_R
  991. XM_"!I`%9P`!`H``]R`>&A("W_X,"!2H!G*")M__P@:0!6+'@`!$ZN_HPK0/_P^
  992. XM2JW_\&<.(FW_\"QX``1.KOZ&8-@B+`-(LJP#TF<`_S0K?```)P__[$YQ(&W_R
  993. XM_"QL`YA.KO^X(FP#G"QX``1.KOYB(FP#F"QX``1.KOYB("W_[$S?0`1.74YU5
  994. XM<`!.=4YU3G5(YS`"+'D```.<(F\`$$SO``\`%$ZN_LY,WT`,3G4``````^P`.
  995. XM```!`````````=H````$`````0``!Z8```&.```!%`````X````````#\@``U
  996. XM`^H```#F````````````````````````````````````````````````9&]S9
  997. XM+FQI8G)A<GD``````$)A8VMD<F]P("A#*2!#;W!Y<FEG:'0@161D>2!#87)RD
  998. XM;VQL(#$Y.#DL(&%D9',@8F%C:V1R;W`@=&\@5V]R:V)E;F-H('-C<F5E;@H``
  999. XM57-A9V4Z($)A8VMD<F]P('LM9B!\("UP(R!\("UQ('P@+7,@?"!",4(R0C-"O
  1000. XM-$(U0C9"-T(X?0H*"0DM82,@+2!3970@9F]R96=R;W5N9"!C;VQO=7(@=&\@U
  1001. XM<W!E8VEF:65D('!E;B`C"@D)+6(C("T@4V5T(&)A8VMG<F]U;F0@8V]L;W5RM
  1002. XM('1O('-P96-I9FEE9"!P96X@(PH`"0DM9B`@+2!%;F%B;&4@9F%S="!U<&1A0
  1003. XM=&4@*'5S97,@;6]R92!M96UO<GDI"@D)+7`C("T@57-E('-P96-I9FEE9"!PH
  1004. XM871T97)N(",@*#$M-2D*"0DM<2`@+2!296UO=F4@8F%C:V1R;W`@9G)O;2!M1
  1005. XM96UO<GD*"0DM<R`@+2!%;F%B;&4@<VQO=R!U<&1A=&4*("`@0C%",D(S0C1""
  1006. XM-4(V0C="."`M(#$V(&AE>"!D:6=I=',@9&5F:6YI;F<@86X@.'@X('!A='1E6
  1007. XM<FX*"CX@`$)A8VMD<F]P``!55:JJ556JJE55JJI55:JJ__]`0$!`0$#__P0$T
  1008. XM!`0$!(B(````````B(@```````"(B```(B(``(B(```B(@``JJH``*JJ``"JJ
  1009. XMJ@``JJH``*JJ``!550``JJH``%55``"(B"(BB(@B(HB((B*(B"(BJJJJJE55<
  1010. XM556JJJJJ55555<S,,S/,S#,SS,PS,\S,,S/__X&!O;VEI:6EO;V!@?___OZ"D
  1011. XM@KJZJJJZNH*"_OX``)F9S,QF9C,SF9G,S&9F,S.9F3,S9F;,S)F9,S-F9LS,N
  1012. XM``!$1"@H$!`H*$1$````````5%0"`EA8&AI`0"HJ``"JJD1$JJH``*JJ1$2JJ
  1013. XMJ@``P\-F9CP\&!@\/&9FP\.!@=O;9F8\/)F9F9D\/&9FV]MF9O#PF9D/#V9F0
  1014. XM\/"9F0\/_____________________P`````!0`#(``$````$````````````N
  1015. XM`````````````````````````````````4)A8VMD<F]P``!I;G1U:71I;VXNX
  1016. X>;&EB<F%R>0!G<F%P:&EC<RYL:6)R87)Y``````/R>
  1017. X``
  1018. Xend
  1019. Xsize 3000
  1020. SHAR_EOF
  1021. echo "extracting backdrop.n"
  1022. sed 's/^X//' << \SHAR_EOF > backdrop.n
  1023. X.TH BACKDROP 1 "AMIGA Programmer's Manual" "Copyright Eddy Carroll 1989"
  1024. X.SH NAME
  1025. Xbackdrop - adds a backdrop behind workbench windows
  1026. X.SH SYNOPSIS
  1027. Xbackdrop {-a# | -b# | -f | -p# | -q | -s | b1b2b3b4b5b6b7b8}
  1028. X.SH DESCRIPTION
  1029. XBackdrop allows you to define a pattern which will then be displayed on
  1030. Xthe workbench screen in the normally empty area behind all the windows.
  1031. XI originally wrote it because I was experimenting an overscan interlaced
  1032. Xworkbench, and I wanted to get that 'workstation' look. The only program
  1033. XI had which would give a similar effect was DropCloth by Eric Lavitsky,
  1034. Xbut this requires Workbench to be loaded. Backdrop will not
  1035. Xcohabit very well with Workbench, which suits me fine since I hardly
  1036. Xever use Workbench.
  1037. X
  1038. XThe first time you run Backdrop, it detaches itself from the CLI and
  1039. Xhangs around in memory until you tell it to quit. You can change the
  1040. Xcurrent settings by running Backdrop again with different options.
  1041. XOnly those options you specify will be altered, all the others will remain
  1042. Xunchanged.
  1043. X
  1044. XThe following options can be specified:
  1045. X
  1046. X-a followed by a number sets the foreground colour used to
  1047. Xplot the pattern to the pen number specified
  1048. X(normally 0 to 3). Similarly, -b sets the background colour.
  1049. X
  1050. X-f and -s select the window type used by Backdrop. -f uses a SMART_REFRESH
  1051. Xwindow, which results in fast updating of the screen, but can use up to 64K of
  1052. Xchip memory (in interlace mode). -s uses a SIMPLE_REFRESH window, which
  1053. Xgives slower updating of the screen but doesn't use up any chip memory.
  1054. XIf you can afford the memory, -f looks much more professional.
  1055. X
  1056. X-p followed by a number selects one of the built in patterns for display.
  1057. XPattern 0 is the default pattern. Numbers from 1 upwards select other
  1058. Xpatterns. If you try to select a non-existant pattern, you get the
  1059. Xdefault pattern.
  1060. X
  1061. X-q tells any copy of Backdrop already resident in memory to remove itself,
  1062. Xand restore the screen back to normality. If Backdrop isn't already resident,
  1063. Xthen this option has no effect.
  1064. X
  1065. XFinally, you can define your own unique pattern by giving a list of 16 hex
  1066. Xdigits. These are interpreted as 8 bytes, with each byte corresponding to
  1067. Xone row of an 8x8 grid. This grid is then replicated over the entire screen
  1068. Xto form the pattern. Try experimenting with random values to generate some
  1069. Xunique patterns.
  1070. X
  1071. XAny or all of these options may be present on the command line, and
  1072. Xorder is not important. You can get a summary of these options by invoking
  1073. XBackdrop with -h (or any other invalid option).
  1074. X.SH CAVEATS
  1075. XIf you try running this when Workbench is running, Workbench will disappear
  1076. X(this could be viewed as a benefit :-) You can quite easily recover
  1077. XWorkbench by telling Backdrop to quit with the -q option.
  1078. X.SH DISTRIBUTION
  1079. XAlthough I retain copyright of Backdrop, it may be freely redistributed
  1080. Xas long as no charge is made other than to cover distribution costs.
  1081. X.SH EXAMPLES
  1082. X.bo "Backdrop
  1083. Xinstalls a simple backdrop pattern
  1084. X.br
  1085. X.bo "Backdrop -a0 -b3 -p1
  1086. Xinstalls a red brick wall pattern
  1087. X.br
  1088. X.bo "Backdrop -a2 cccc666633339999
  1089. Xinstalls dark stripes pattern
  1090. X.SH AUTHOR
  1091. XEddy Carroll
  1092. X.br
  1093. XThe Old Rectory,
  1094. X.br
  1095. XDelgany, Co. Wicklow,
  1096. X.br
  1097. XIreland.
  1098. X
  1099. XEMAIL: ecarroll@@cs.tcd.ie
  1100. SHAR_EOF
  1101. echo "End of archive 1 (of 1)"
  1102. # if you want to concatenate archives, remove anything after this line
  1103. exit
  1104.